﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonopolyGame
{
    /// <summary>
    /// Class for the player pawn
    /// </summary>
    class Player
    {
        #region Fields

        public string ID { get; private set; } 

        Texture2D sprite;

        public Rectangle rect;

        public int money { get; private set; }

        Vector2 velocity=new Vector2(55,55);


        bool isInJail;

        #endregion

        public Player(ContentManager content, string spriteName, int x, int y)
        {
            LoadContent(content, spriteName, x, y);
            this.isInJail = false;
        }


        public void Update(int i)
        {
            if (i != 0)
            {
                if (GameClass.bottom.Contains(rect))
                {
                    rect.X -= (int)velocity.X;
                    //if (target.Contains(rect))
                    //{
                    //    dies.isRolled = false;
                    //}
                }
                else if (GameClass.left.Contains(rect))
                {
                    rect.Y -= (int)velocity.Y;
                }
                else if (GameClass.top.Contains(rect))
                {
                    rect.X += (int)velocity.X;
                }
                else if (GameClass.right.Contains(rect))
                {
                    rect.Y += (int)velocity.Y;
                }
            }
      
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(sprite, rect, Color.White);
        }
        private void LoadContent(ContentManager contentManager, string spriteName, int x, int y)
        {
            // load content and set remainder of draw rectangle
            sprite = contentManager.Load<Texture2D>(spriteName);
            rect = new Rectangle(x, y, 30, 30);
        }

    }
}
